<template>
  <div class="dashboard-container">
    <div class="dashboard-header">
      <h1>仪表盘</h1>
      <p>欢迎使用员工管理系统</p>
    </div>
    
    <!-- 统计卡片 -->
    <div class="stats-grid">
      <el-card class="stat-card" shadow="hover">
        <div class="stat-content">
          <div class="stat-icon user">
            <el-icon :size="32"><User /></el-icon>
          </div>
          <div class="stat-info">
            <h3>员工总数</h3>
            <p class="stat-number">1,234</p>
          </div>
        </div>
      </el-card>
      
      <el-card class="stat-card" shadow="hover">
        <div class="stat-content">
          <div class="stat-icon department">
            <el-icon :size="32"><OfficeBuilding /></el-icon>
          </div>
          <div class="stat-info">
            <h3>部门数量</h3>
            <p class="stat-number">12</p>
          </div>
        </div>
      </el-card>
      
      <el-card class="stat-card" shadow="hover">
        <div class="stat-content">
          <div class="stat-icon project">
            <el-icon :size="32"><Document /></el-icon>
          </div>
          <div class="stat-info">
            <h3>进行中项目</h3>
            <p class="stat-number">56</p>
          </div>
        </div>
      </el-card>
      
      <el-card class="stat-card" shadow="hover">
        <div class="stat-content">
          <div class="stat-icon task">
            <el-icon :size="32"><List /></el-icon>
          </div>
          <div class="stat-info">
            <h3>待办任务</h3>
            <p class="stat-number">89</p>
          </div>
        </div>
      </el-card>
    </div>
    
    <!-- 快速操作 -->
    <div class="quick-actions">
      <el-card shadow="hover">
        <template #header>
          <h3>快速操作</h3>
        </template>
        <div class="action-buttons">
          <el-button type="primary" :icon="Plus">添加员工</el-button>
          <el-button type="success" :icon="Download">导出数据</el-button>
          <el-button type="warning" :icon="Upload">导入数据</el-button>
          <el-button type="info" :icon="Setting">系统设置</el-button>
        </div>
      </el-card>
    </div>
    
    <!-- 最近活动 -->
    <div class="recent-activity">
      <el-card shadow="hover">
        <template #header>
          <h3>最近活动</h3>
        </template>
        <el-timeline>
          <el-timeline-item timestamp="2024-01-15 10:30" placement="top">
            <p>张三 加入了 技术部</p>
          </el-timeline-item>
          <el-timeline-item timestamp="2024-01-14 16:20" placement="top">
            <p>李四 完成了 项目开发任务</p>
          </el-timeline-item>
          <el-timeline-item timestamp="2024-01-14 14:15" placement="top">
            <p>王五 提交了 月度报告</p>
          </el-timeline-item>
          <el-timeline-item timestamp="2024-01-13 09:00" placement="top">
            <p>系统进行了 版本更新</p>
          </el-timeline-item>
        </el-timeline>
      </el-card>
    </div>
  </div>
</template>

<script setup lang="ts">
import {
  User,
  OfficeBuilding,
  Document,
  List,
  Plus,
  Download,
  Upload,
  Setting
} from '@element-plus/icons-vue'
</script>

<style scoped>
.dashboard-container {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

.dashboard-header {
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
}

.dashboard-header p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.stat-icon.user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.department {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.project {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-icon.task {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-info h3 {
  font-size: 14px;
  color: #666;
  margin: 0 0 8px 0;
}

.stat-number {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.quick-actions {
  margin-bottom: 24px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.recent-activity {
  margin-bottom: 24px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons .el-button {
    width: 100%;
  }
}
</style>
